<?php
require('functions/page_load.php');

$testimonials_nav = true;

if($_SERVER['REQUEST_METHOD'] == 'POST'){

$sql = "INSERT INTO testimonials SET name = '".mysql_real_escape_string($_POST['name'])."', testimonial = '".mysql_real_escape_string($_POST['testimonial'])."'";
$query = mysql_query( $sql ) or die ("Error in query: $sql. " . mysql_error());
$new_id = mysql_insert_id();

header("Location: edit_testimonial.php?id=".$new_id."&new=true");

}

require('includes/header.php');
?>

<div class="main_container_wrapper">

	<div class="main_container">
	<h2 class="container_header">Add Testimonial</h2>
	
	<form method="post" action="">

	<div class="form_row_wrapper">
	<div class="form_row_left"><label for="name">Name:</label></div>
	<div class="form_row_right"><input type="text" name="name" id="name" class="textbox" /></div>
	</div>

	<div class="form_row_wrapper">
	<div class="form_row_left"><label>Testimonial:</label></div>
	<div class="form_row_right">
	<textarea name="testimonial" id="testimonial" rows="6" cols="30" class="textbox"></textarea>
	</div>
	</div>
	
	<div class="form_row_wrapper">
	<div class="form_row_left">&nbsp;</div>
	<div class="form_row_right"><input type="image" src="images/save_button.png" alt="Save" /></div>
	</div>
	
	</form>

	</div>

</div>
	
<?php
	require('includes/footer.php');
?>